import io.vertx.core.Future
import io.vertx.core.Handler
import io.vertx.ext.web.RoutingContext
import top.knos.servex.top.knos.servex.plugin.PluginRoute
import top.knos.servex.top.knos.servex.plugin.ServexPlugin

// 3. 插件基类（可选，提供便利方法）
abstract class AbstractServexPlugin : ServexPlugin {
    protected val routes = mutableListOf<PluginRoute>()

    override fun getRoutes(): List<PluginRoute> = routes.toList()

    protected fun route(path: String, method: String = "GET", handler: Handler<RoutingContext>) {
        routes.add(PluginRoute(path, method, handler))
    }

    override fun stop(): Future<Void> {
        return Future.succeededFuture()
    }
}